-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Async Profiler Feature #203
Conversation
@mrproliu We don't have backend ready, as we need this to verify the backend. Please review from codes as much as possible. |
@zhengziyi0117 Please fix CI. |
var Command = &cli.Command{ | ||
Name: "asyncprofiler", | ||
Usage: "async profiler related sub-command", | ||
UsageText: `todo`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the usage text.
) | ||
|
||
var Command = &cli.Command{ | ||
Name: "asyncprofiler", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this command is under the profiling
command, should we remove the profiler
suffix?
For now, the command should be: swctl profiling asyncprofiler
, I think it could be: swctl profiling async
is much clear, what do you think?
eventTypes = append(eventTypes, query.AsyncProfilerEventType(upperCaseEvent)) | ||
} | ||
|
||
execArgs := ctx.String("exec-args") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make the type of execArgs
as *string
, and assign the value when judgment the ctx.String
is not an empty string? You will get an empty string even if the exec-args
is not declared.
eventTypes := make([]query.AsyncProfilerEventType, 0) | ||
for _, event := range events { | ||
upperCaseEvent := strings.ToUpper(event) | ||
eventTypes = append(eventTypes, query.AsyncProfilerEventType(upperCaseEvent)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is best to create an enum model to obtain the event types, and the CLI should verify whether we have an enum value. You can refer to https://github.com/apache/skywalking-cli/blob/master/internal/model/type.go. However, the type you choose should be a slice, which is slightly different from the existing reference.
&cli.StringFlag{ | ||
Name: "event", | ||
Usage: "which event types this task needs to collect.", | ||
Required: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enum should be a new model. Instant of a string value without any type check.
|
||
request := &query.AsyncProfilerAnalyzationRequest{ | ||
TaskID: ctx.String("task-id"), | ||
InstanceIds: ctx.StringSlice("service-instance-ids"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use String
and split by self.
startTime := ctx.Int64("start-time") | ||
endTime := ctx.Int64("end-time") | ||
limit := ctx.Int("limit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us declare the startTime
, endTime
, and limit
as *int64
or *int
first, otherwise the value will be 0
.
|
||
var getTaskProgressCommand = &cli.Command{ | ||
Name: "progress", | ||
Aliases: []string{"logs", "p"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be used as swctl profiling asyncprofiler logs
? I think it's a difference in the meaning of progress.
@zhengziyi0117 Also, please update the CHANGES.md |
Co-authored-by: mrproliu <[email protected]>
Co-authored-by: mrproliu <[email protected]>
Co-authored-by: mrproliu <[email protected]>
Pls run golangci-lint locally to ensure it can pass CI |
instanceNameFlagName = "instance-name" | ||
destInstanceIDFlagName = "dest-instance-id" | ||
destInstanceNameFlagName = "dest-instance-name" | ||
InstanceIDSliceFlagName = "instance-id-slice" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use "list" instant of "slice"
Examples: | ||
1. Query the flame graph produced by async-profiler | ||
$ swctl profiling async analysis --service-name=service-name --task-id=task-id \ | ||
--service-instance-ids=instance-name1,instance-name2 --event=execution_sample`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update all incorrect name of the parameter.
Could you update the PR description to add which commands are you adding, and put some examples(input and output) in it? |
Add the sub-command
profiling async
for async-profiler query APIHere are some examples